<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
    content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <title>患者列表</title>
  <link rel="stylesheet" type="text/css" href="../css/api.css" />
  <link rel="stylesheet" type="text/css" href="../css/style.css" />
  <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
  <style>
    .hospital>div {
      width: 100%;
      height: 40px;
      margin-top: 5px;
    }

    .hospital>div:nth-of-type(odd) {
      background-color: #ddd;
    }

    .hospital>div:nth-of-type(even) {
      background-color: #8bcdfb;
    }

    .hospital>div>span {
      padding-left: 5px;
      display: inline-block;
      height: 40px;
      line-height: 40px;
    }
    .aui-list-item-inner{
      width: 100%;
    }

    .aui-list-item-inner>div {
      display: -webkit-flex;
      display: flex;
      /* align-items: center; */
      flex-direction: row;
      justify-content: space-between;
      width: 100%;
    }
    .aui-list-item-inner > div >span:nth-child(1){
        text-align: left;
        padding-left: 10px;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        -ms-box-sizing: border-box;
        -o-box-sizing: border-box;
        box-sizing: border-box;
      }
      .aui-list-item-inner > div >span:nth-child(1){
        flex: 1;
      }
      .aui-list-item-inner > div >span{
        flex: 1;
        text-align: center;
        font-size: 14px;
      }
      .aui-list-item-inner > div >span:nth-child(2),.aui-list-item-inner > div >span:nth-child(3){
        flex: 0.7;
      }
      .aui-list-item-inner > div >span:nth-child(4){
        flex: 0.6 !important;
      }
      .aui-list-item-inner > div >span:nth-child(2){
        display: inline-block;
        background-image: url('../image/nickname.png');
        width: 100px;
        height: 40px;
        background-repeat: no-repeat;
        background-position: 10px 5px;
        background-size: 20px 20px;
        line-height: 40px;
        text-align: left;
        padding-left: 40px;
      }
      .aui-list-item-inner > div >span:nth-child(4){
        display: inline-block;
        width: 100px;
        height: 40px;
        background-repeat: no-repeat;
        background-position: 25px 5px;
        background-size: 25px 25px;
        line-height: 40px;
      }
    .aui-btn-info,
    .aui-btn-danger {
      width: 60px;
      height: 30px;
      text-align: center;
      line-height: 10px;
      padding: 10px 10px 13px 10px !important;
    }

    .aui-iconfont {
      font-size: 14px;
    }

    .aui-btn-danger {
      background-color: #d4237a !important;
    }

    .aui-content ul li:nth-of-type(odd) {
      background: #f0f0f0;
    }

    /* 搜索 */
    .top-search {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      height: 3rem !important;
    }
  </style>
</head>

<body>
  <section class="hospital">
    <!-- 搜索 -->

    <div class="top-search clearfix">
      <!-- 输入框 -->
      <div class="aui-searchbar-input aui-border-radius">
        <i class="aui-iconfont aui-icon-search"></i>
        <input type="search" placeholder="请输入搜索内容" id="aiName">
      </div>
      <!-- 按钮 -->
      <div class="aui-pull-right aui-btn"  onclick="Query_getHoTreatmentRegister()">
        <span class="aui-iconfont aui-icon-search"></span>
      </div>
    </div>
    <!--  -->
    <div class="aui-content aui-margin-b-15">
      <ul class="aui-list aui-list-in" style="font-size: 15px;width: 100%" id="HoTreatmentRegister">
      </ul>
    </div>
  </section>
</body>

</html>

<script src="../script/api.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/vue.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/jquery.min.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/ToConfigure.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-toast.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-dialog.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-tab.js" charset="utf-8" type="text/javascript"></script>
<script type="text/javascript">
  var vm = null;
  apiready = function () {

    vm = new Vue({
      el: '.hospital',
      data: {
        manIcon: {
          backgroundImage: "url(../image/sex_man.png)"
        },
        womanIcon: {
          backgroundImage: "url(../image/sex_woman.png)"
        },
        JsParms: {
          pageSize: 10,
          currPage: 1,
          trType:1,
        }
      },
      created() {
        var JsonStr = JSON.stringify(this.JsParms);
        getHoTreatmentRegister(JsonStr)

      },
      methods: {
      }
    })

    // // 下拉监听
    // var param = {};
    // param.loadingImgae = 'widget://image/refresh.png'; //定义刷新小箭头的图片
    // param.bgColor = 'transparent'; //定义下拉刷新区域的背景
    // param.textColor = '#111'; //定义下拉刷新提示文字的颜色
    // param.textDown = '下拉刷新...'; //定义下拉刷新文字
    // param.textUp = '松开试试...'; //定义松开刷新文字
    // param.showTime = true; //定义是否显示最后一次刷新时间
    // api.setRefreshHeaderInfo(param, function(ret, err){
    //   vm.evaluationList = vm.copyEvaluationList
    //   setTimeout(() => {
    //     api.refreshHeaderLoadDone(); //复位下拉刷新
    //   }, 500)
    // });

    // 加载监听
    api.addEventListener({ name: 'scrolltobottom' }, function (ret, err) {

      vm.JsParms.pageSize = (vm.JsParms.pageSize + 10);
      if (vm.JsParms.currPage) {
        api.showProgress({
          title: '努力加载中...',
          text: '',
          modal: true
        });
        var JsonStr = JSON.stringify(vm.JsParms);
        getHoTreatmentRegister(JsonStr);
      }
    });
  }

  function getHoTreatmentRegister(JsonStr) {
    //清空页面
    $("#HoTreatmentRegister").html("");
    //定义toast提示框
    var toast = new auiToast();
    //定义拼接html变量
    var HoTreatmentRegister = "";
    //获取所属医院IP地址
    var Url_IP = ToConfigure_IP("Gorgeous");
    /**
     * 请求控制器
     */
    $.ajax({
      url: Url_IP + '/businessmanagement/hotreatmentregister/getHoTreatmentRegister',
      type: 'post',
      async: false,
      contentType: "application/json",
      dataType: "json",
      data: JsonStr,
      success: function (result) {
        /**
         * 验证返回信息是否为空
         */
        if (result.success == true) {
          $.each(result.data.list, function (i, o) {
            //拼接html
            HoTreatmentRegister += "<li class=\"aui-list-item\" onclick=\"PatientDetails(" + o.trId + ")\">";
            HoTreatmentRegister += "<div class=\"aui-list-item-inner\">";
            HoTreatmentRegister += "<div>";
            HoTreatmentRegister += "<span>" + o.trPatientNo + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiName + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiAge + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiGender + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiPhone + "</span>";
            HoTreatmentRegister += "<span>" + o.trDiagnosis + "</span>";
            if (o.trType == 1) {
              HoTreatmentRegister += "<span style=\"color: #f8ac59;\">正常</span>";
            } else if (o.trType == 2) {
              HoTreatmentRegister += "<span style=\"color: #7266ba;\">暂停</span>";
            } else if (o.trType == 3) {
              HoTreatmentRegister += "<span style=\"color: #8f8d9c;\">失约</span>";
            } else if (o.trType == 4) {
              HoTreatmentRegister += "<span style=\"color: #ed5565;\">结束</span>";
            }
            HoTreatmentRegister += "</div>";
            HoTreatmentRegister += "</div>";
            HoTreatmentRegister += "</li>";
          })
          //渲染页面
          $("#HoTreatmentRegister").html(HoTreatmentRegister);
          api.hideProgress();
          toast.success({
            title: "加载成功",
            duration: 1000
          });
        } else {
          api.hideProgress();
          toast.fail({
            title: "加载失败",
            duration: 2000
          });
        }
      },
      error: function (result) {
        api.hideProgress();
        toast.fail({
          title: "加载失败",
          duration: 2000
        });
      }
    });
  }
  //根据条件查询
  function Query_getHoTreatmentRegister() {
    //清空页面
    $("#HoTreatmentRegister").html("");
    //定义toast提示框
    var toast = new auiToast();
    //定义拼接html变量
    var HoTreatmentRegister = "";
    //获取所属医院IP地址
    var Url_IP = ToConfigure_IP("Gorgeous");
    var Js_Parms = new Object();
    /**
     * 获取姓名
     */
    var hoArchivalInformationEntity = new Object();
    hoArchivalInformationEntity.aiName = $("#aiName").val();
    Js_Parms.hoArchivalInformationEntity = hoArchivalInformationEntity;
    Js_Parms.currPage = 1;
    var json_Str = JSON.stringify(Js_Parms);
    /**
     * 请求控制器
     */
    $.ajax({
      url: Url_IP + '/businessmanagement/hotreatmentregister/getHoTreatmentRegister',
      type: 'post',
      async: false,
      contentType: "application/json",
      dataType: "json",
      data: json_Str,
       success: function (result) {
        /**
         * 验证返回信息是否为空
         */
        if (result.success == true) {
          $.each(result.data.list, function (i, o) {
            //拼接html
            HoTreatmentRegister += "<li class=\"aui-list-item\" onclick=\"PatientDetails(" + o.trId + ")\">";
            HoTreatmentRegister += "<div class=\"aui-list-item-inner\">";
            HoTreatmentRegister += "<div>";
            HoTreatmentRegister += "<span>" + o.trPatientNo + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiName + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiAge + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiGender + "</span>";
            HoTreatmentRegister += "<span>" + o.hoArchivalInformationEntity.aiPhone + "</span>";
            HoTreatmentRegister += "<span>" + o.trDiagnosis + "</span>";
            if (o.trType == 1) {
              HoTreatmentRegister += "<span style=\"color: #f8ac59;\">正常</span>";
            } else if (o.trType == 2) {
              HoTreatmentRegister += "<span style=\"color: #7266ba;\">暂停</span>";
            } else if (o.trType == 3) {
              HoTreatmentRegister += "<span style=\"color: #8f8d9c;\">失约</span>";
            } else if (o.trType == 4) {
              HoTreatmentRegister += "<span style=\"color: #ed5565;\">结束</span>";
            }
            HoTreatmentRegister += "</div>";
            HoTreatmentRegister += "</div>";
            HoTreatmentRegister += "</li>";
          })
          //渲染页面
          $("#HoTreatmentRegister").html(HoTreatmentRegister);
          api.hideProgress();
          toast.success({
            title: "加载成功",
            duration: 1000
          });
        } else {
          api.hideProgress();
          toast.fail({
            title: "加载失败",
            duration: 2000
          });
        }
      },
      error: function (result) {
        api.hideProgress();
        toast.fail({
          title: "加载失败",
          duration: 2000
        });
      }
    });
  }
  function PatientDetails(F_ID) {
    api.openWin({
      name: 'patientDetailHeader',
      url: './patientDetailHeader.html',
      pageParam: {
        F_ID: F_ID,
        userName:api.pageParam["userName"]

      }
    });
  }

  function enterEvaluation() {
    api.openWin({
      name: 'evaluation-header',
      url: './evaluation-header.html',
      pageParam: {
        name: 'evaluation-header',
        userName:api.pageParam["userName"]
      }
    });
  }
  function enterConsent() {
    api.openWin({
      name: 'consent-header',
      url: './consent-header.html',
      pageParam: {
        name: 'consent-header',
        userName:api.pageParam["userName"]
      }
    });
  }
</script>